<template>
	<view class="">
		<u-toast ref="uToast"></u-toast>
		<!-- <view class="">
			<text>投诉:</text>
			<u--textarea v-model="content" placeholder="请输入内容" count></u--textarea><br>
			<text>手机号码:</text>
			<u--input placeholder="请输入手机号码" v-model="phone"></u--input>
		</view>
		<view class="buttom">
			<u-button type="primary" text="提交" @click="click"></u-button>
		</view> -->
		<u--form labelPosition="left" ref="uForm" labelWidth=75>
			<u-form-item label="投诉:" prop="userInfo.name" borderBottom ref="item1">
				<u--textarea v-model="content" placeholder="请输入内容" count class="border"></u--textarea>
			</u-form-item>
			<u-form-item label="手机号:" prop="userInfo.name" borderBottom ref="item1">
				<u--input v-model="phone" border="none" placeholder="请输入手机号"></u--input>
			</u-form-item>
		</u--form>
		<view class="buttom">
			<u-button type="primary" text="提交" @click="click"></u-button>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				content: '',
				phone: ''
			}
		},
		methods: {
			click() {
				console.log(this.content)
				console.log(this.phone)
				if (this.phone.length == 11) {
					uni.request({
						url:'http://124.223.168.50:8000/booking/suggestionAPIView/',
						method:'POST',
						data:{
							content:this.content,
							phone:this.phone,
							open_id:'asdasdas'
						},
						timeout:6000,
						success: (res) => {
							console.log(res)
						},
						fail: (err) => {
							console.log(err)
						}
					})
					this.$refs.uToast.show({
						type: 'success',
						message: '提交成功，感谢您的反馈'
					})
					uni.redirectTo({
						url:'../Home/Home'
					})
					// this.content = ''
					// this.phone = ''
				} else {
					this.$refs.uToast.show({
						type: 'warning',
						message: '手机位数不正确!'
					})
				}
			}
		}
	}
</script>

<style scoped>
	.buttom {
		position: fixed;
		bottom: 0rpx;
		width: 750rpx;
		background-color: deepskyblue;
		color: whitesmoke;
	}

	.border {
		border: 1px solid lightblue;
	}
</style>